package com.freewater.library.lending.book.presentation.request;

import com.freewater.library.lending.book.application.command.ReserveBookInstanceCommand;
import lombok.Getter;
import org.apache.commons.lang3.Validate;

@Getter
public class ReserveBookInstanceRequest {
    /**
     * ISBN
     */
    private final String isbn;
    /**
     * 读者Id
     */
    private final Long readerId;

    public ReserveBookInstanceRequest(String isbn, Long readerId) {
        Validate.notBlank(isbn, "ISBN不能为空");
        Validate.notNull(readerId, "读者ID不能为空");
        this.isbn = isbn;
        this.readerId = readerId;
    }

    public ReserveBookInstanceCommand toCommand() {
        return new ReserveBookInstanceCommand(this.isbn, this.readerId);
    }
}
